package com.blog.cloud.controller.rec.register;

import com.blog.cloud.comm.modal.dto.ResponeObj;
import com.blog.cloud.controller.base.BaseController;
import com.blog.cloud.service.UserService;
import com.jfinal.core.ActionKey;

public class RegisterController extends BaseController {
	
	public void index(){
		
		setAttr("selected", "reg");
		setAttr("selectedC", "reg");
		String responeJspPrefix = super.getResponeJspPrefix("rec_signup.jsp");
		//responeJspPrefix = super.getResponeJspPrefix("_layout_signup.jsp");
		render(responeJspPrefix);
	}
	
	@ActionKey("sginup")
	public void sginUp(){
		
		String basePar = "val-";
		String nameVal = getPara(basePar+"username");
		String emailVal = getPara(basePar+"email");
		String passwordVal = getPara(basePar+"password");
		UserService.ser.insertUser(nameVal, emailVal, passwordVal);
		renderJson(new ResponeObj("200","注册成功！",null));
		
	}

}
